{% extends 'public/seed_base.html' %}
{% block head %}
    <script type="text/javascript" src="{{ url_for('static',filename='./lib/ckeditor/ckeditor.js') }}"></script>
{% endblock %}
{% block content %}
    <form class="layui-form">
        {% for foo in form %}
            {% if foo.type!='BooleanField'and foo.type!='IntegerField' %}
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        {{ foo.label }}
                    </label>
                    <div class="layui-input-inline"
                         {% if foo.name=='superior' or foo.name=='permissions' or foo.name=='update_time' or foo.name=='contributor' or foo.name=='promulgator'or foo.name=='author' or foo.name=='source' %}style="width: 25%;"
                         {% elif foo.name=='thumb_img' %}style="width: 50%;"
                         {% else %}style="width: 75%;"{% endif %}>
                        {{ foo }}
                        {% if foo.name=='thumb_img' %}
                            <span class="layui-btn layui-btn-normal" onclick="open_file()">上传图片</span>
                        {% endif %}
                    </div>
                </div>
            {% endif %}
        {% endfor %}
        <div class="layui-form-item">
            <label class="layui-form-label">权重</label>
            <div class="layui-input-block">
                {% for foo in form %}
                    {% if foo.name=='weight' %}
                        {{ foo }}
                    {% elif foo.name=='clicks' %}
                        <label class="layui-form-label">{{ foo.label }}</label>{{ foo }}
                    {% endif %}
                {% endfor %}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">属性</label>
            <div class="layui-input-block">
                {% for foo in form %}
                    {% if foo.type=='BooleanField' %}
                        {{ foo }}
                    {% endif %}
                {% endfor %}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <a class="layui-btn" href="javascript:;" onclick="ckeditor_submit()">提交保存</a>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
        <script>
            var content = CKEDITOR.replace('content', {});
        </script>
        <input type="file" id="upload" name="upload" accept="image/*" onchange="document_upload_file('{{ url_for('cms_bp.upload_img') }}')"
               style="display:none"/>
    </form>
{% endblock %}
{% block footer_js %}
    <script type="text/javascript" src="{{ url_for('static',filename='./js/datatime.js') }}"></script>
{% endblock %}